# #基本的prompt模板
# # PromptTemplate
# from langchain.prompts import PromptTemplate
# template = PromptTemplate.from_template("讲一个{name}的故事")
# print(template)
# print(template.format(name="关羽"))

# from langchain_core.prompts import SystemMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate
# from yunjian.model import get_model
# from langchain.prompts import ChatPromptTemplate
# model = get_model()
#
# template=ChatPromptTemplate.from_messages([
#     SystemMessagePromptTemplate.from_template(
#    " 你是一个AI助手，你的名字叫{name}"
#    ),
#     HumanMessagePromptTemplate.from_template("{question}"),
#     AIMessagePromptTemplate.from_template("你好，我叫{name},很高兴为你解答")
# ])
#
# prompt = template.format_messages(name="张三", question="你好")
# # 将模板给到模型进行提问
# print(model.invoke(prompt).content)

# from yunjian.model import get_model
# from langchain_core.prompts import PromptTemplate, FewShotPromptTemplate
#
# model = get_model()
# # 例子
# examples =[
#     {"input": "大", "output": "小"},
#     {"input": "上", "output": "下"},
#     {"input": "左", "output": "右"},
# ]
#
# example_prompt = PromptTemplate(
#     input_variables=["input", "output"],
#     template="{input} -> {output}",
#
# )
#
# prompt = FewShotPromptTemplate(
#     examples=examples,
#     example_prompt=example_prompt,
#     prefix="请将输入的字符转换成对应的输出",
#     suffix="输入: {input}\n输出:", #要放在示例后面的提示模板字符串，
#     input_variables=["input"], #传入的变量
# )
# p = prompt.format(input="胖")
# print(model.invoke(p).content)

from langchain.prompts import load_prompt
prompt = load_prompt("a.json",encoding="utf-8")
print(prompt.format(name="张三",love="run"))